<#include "/include/tag.ftl">
<html lang="en">
<head>
	<title>Share Advance</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<#include "/include/common.ftl">
</head>

<body class="home">
	<#include "/template/header.ftl">
	<div id="content-wrapper">
		<header class="head secondary"></header>
		
		<!-- container -->
		<div class="container">
		
			<ol class="breadcrumb">
				<li><a href="${ctx}/index">首页</a></li>
				<li class="active">注册</li>
			</ol>
		
			<div class="row">
				
				<!-- Article main content -->
				<article class="col-xs-12 maincontent">
					<header class="page-header">
						<h1 class="page-title">注册</h1>
					</header>
					
					<div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
						<div class="panel panel-default">
							<div class="panel-body">
								<h3 class="thin text-center"><span class="glyphicon glyphicon-user"></span>&nbsp;&nbsp;注册用户</h3>
								<hr>
		
								<form id="regist_form" action="${ctx}/regist" method="POST">
									<div class="top-margin">
										<label>用户名<span class="text-danger">*</span></label>
										<input type="text" id="username" name="username" class="form-control">
									</div>
									<div class="top-margin">
										<label>邮箱地址 <span class="text-danger">*</span></label>
										<input type="text" id="email" name="email" class="form-control">
									</div>
		
									<div class="top-margin">
										<label>密码 <span class="text-danger">*</span></label>
										<input type="password" id="password" name="password" class="form-control">
									</div>
									<div class="top-margin">
										<label>确认密码 <span class="text-danger">*</span></label>
										<input type="password" name="confirm_password" class="form-control">
									</div>
									<div class="row top-margin">
										<div class="col-lg-6">
											<label>验证码 <span class="text-danger">*</span></label>
											<input type="text" name="captcha" class="form-control">
										</div>
										<div class="col-lg-6">
											<img src="" />
										</div>
									</div>
									<hr>
									<div class="row top-margin">
										<div class="col-lg-8">
											<label>
												<input type="checkbox" />我已阅读同意&nbsp;&nbsp;<a href="#">注册条款</a>
											</label>                      
										</div>
										<div class="col-lg-4 text-right">
											<button class="btn btn-primary" type="submit" id="regist_btn">注册</button>
										</div>
									</div>
								</form>
							</div>
						</div>
		
					</div>
					
				</article>
				<!-- /Article -->
		
			</div>
		</div>	<!-- /container -->
	</div>
	<#include "/template/footer.ftl">
</body>
</html>

<script type="text/javascript">
	$(function(){
		$("#regist_form").validate({
			rules : {
				username: {required:true,minlength:3,
					remote : {
						url : "${ctx}/checkUsername",//自动加载请求参数
						type : "POST",
					}
			    },
				email: {required:true,email:true,
					remote : {
						url : "${ctx}/checkEmail",
						type : "POST",
					}
				},
				password: {required:true,minlength:6},
				confirm_password: {required: true, equalTo: "#password"},
				captcha: {required:true, 
					remote : {
						url : "${ctx}/checkCaptcha",
						type : "POST",
					}
				}
			},
			messages : {
				username: {required:"请输入用户名",minlength:"用户名不能小于3个字 符",remote:"用户名已存在"},
				email: {required:"请输入邮箱地址",email:"邮箱格式有误",remote:"邮箱已存在"},
				password: {required:"请输入密码",minlength: "密码不能小于6个字 符"},
				confirm_password:　{required: "请输入确认密码",equalTo: "两次输入密码不一致"},
				captcha: {required: "请输入验证码",remote: "验证码错误"}
			}
		});
	});
</script>
	

	